//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package location;

import common.Logger;
import common.RoadsideShop;
import messages.VisitedHomeData;

public class VisitedFarm {
    final Farm homeFarm;
    final Farm visitedFarm;
    final String logName;
    private Long visitedId;

    public VisitedFarm(VisitedHomeData vhd, String profileName) {
        this.homeFarm = new Farm(vhd.getHomeInventory(), vhd.getHomeData(), vhd.getHomeShop(), profileName);
        this.visitedFarm = new Farm(vhd.getVisitedInventory(), vhd.getVisitedData(), vhd.getVisitedShop(), profileName);
        this.logName = profileName;
        this.visitedId = vhd.getVisitedId();
    }

    public void reload(boolean quite) {
        this.homeFarm.reload(true);
        System.out.println(Logger.formatP("VisitedFarm ", " ------------- Visited Home " + this.visitedId + " -------------"));
        this.visitedFarm.reload(quite);
    }

    public void update(VisitedHomeData vhd) {
        this.visitedId = vhd.getVisitedId();
        this.homeFarm.update(vhd.getHomeInventory(), vhd.getHomeData(), vhd.getHomeShop());
        this.visitedFarm.update(vhd.getVisitedInventory(), vhd.getVisitedData(), vhd.getVisitedShop());
    }

    public RoadsideShop getHomeShop() {
        return this.homeFarm.getShop();
    }

    public RoadsideShop getVisitedShop() {
        return this.visitedFarm.getShop();
    }

    public Farm getHomeFarm() {
        return this.homeFarm;
    }

    public Farm getVisitedFarm() {
        return this.visitedFarm;
    }

    public Long getVisitedId() {
        return this.visitedId;
    }
}
